
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _Sequence : SqlClientEntity
	{
		public _Sequence()
		{
			this.QuerySource = "Sequence";
			this.MappingName = "Sequence";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SequenceLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(string SeqKey)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.SeqKey, SeqKey);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SequenceLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter SeqKey
			{
				get
				{
					return new SqlParameter("@SeqKey", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter SeqValue
			{
				get
				{
					return new SqlParameter("@SeqValue", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SeqDate
			{
				get
				{
					return new SqlParameter("@SeqDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter SeqLength
			{
				get
				{
					return new SqlParameter("@SeqLength", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string SeqKey = "SeqKey";
            public const string SeqValue = "SeqValue";
            public const string SeqDate = "SeqDate";
            public const string SeqLength = "SeqLength";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[SeqKey] = _Sequence.PropertyNames.SeqKey;
					ht[SeqValue] = _Sequence.PropertyNames.SeqValue;
					ht[SeqDate] = _Sequence.PropertyNames.SeqDate;
					ht[SeqLength] = _Sequence.PropertyNames.SeqLength;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string SeqKey = "SeqKey";
            public const string SeqValue = "SeqValue";
            public const string SeqDate = "SeqDate";
            public const string SeqLength = "SeqLength";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[SeqKey] = _Sequence.ColumnNames.SeqKey;
					ht[SeqValue] = _Sequence.ColumnNames.SeqValue;
					ht[SeqDate] = _Sequence.ColumnNames.SeqDate;
					ht[SeqLength] = _Sequence.ColumnNames.SeqLength;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string SeqKey = "s_SeqKey";
            public const string SeqValue = "s_SeqValue";
            public const string SeqDate = "s_SeqDate";
            public const string SeqLength = "s_SeqLength";

		}
		#endregion		
		
		#region Properties
	
		public virtual string SeqKey
	    {
			get
	        {
				return base.Getstring(ColumnNames.SeqKey);
			}
			set
	        {
				base.Setstring(ColumnNames.SeqKey, value);
			}
		}

		public virtual int SeqValue
	    {
			get
	        {
				return base.Getint(ColumnNames.SeqValue);
			}
			set
	        {
				base.Setint(ColumnNames.SeqValue, value);
			}
		}

		public virtual DateTime SeqDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.SeqDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.SeqDate, value);
			}
		}

		public virtual int SeqLength
	    {
			get
	        {
				return base.Getint(ColumnNames.SeqLength);
			}
			set
	        {
				base.Setint(ColumnNames.SeqLength, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_SeqKey
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SeqKey) ? string.Empty : base.GetstringAsString(ColumnNames.SeqKey);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SeqKey);
				else
					this.SeqKey = base.SetstringAsString(ColumnNames.SeqKey, value);
			}
		}

		public virtual string s_SeqValue
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SeqValue) ? string.Empty : base.GetintAsString(ColumnNames.SeqValue);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SeqValue);
				else
					this.SeqValue = base.SetintAsString(ColumnNames.SeqValue, value);
			}
		}

		public virtual string s_SeqDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SeqDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.SeqDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SeqDate);
				else
					this.SeqDate = base.SetDateTimeAsString(ColumnNames.SeqDate, value);
			}
		}

		public virtual string s_SeqLength
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SeqLength) ? string.Empty : base.GetintAsString(ColumnNames.SeqLength);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SeqLength);
				else
					this.SeqLength = base.SetintAsString(ColumnNames.SeqLength, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter SeqKey
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SeqKey, Parameters.SeqKey);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SeqValue
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SeqValue, Parameters.SeqValue);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SeqDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SeqDate, Parameters.SeqDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SeqLength
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SeqLength, Parameters.SeqLength);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter SeqKey
		    {
				get
		        {
					if(_SeqKey_W == null)
	        	    {
						_SeqKey_W = TearOff.SeqKey;
					}
					return _SeqKey_W;
				}
			}

			public WhereParameter SeqValue
		    {
				get
		        {
					if(_SeqValue_W == null)
	        	    {
						_SeqValue_W = TearOff.SeqValue;
					}
					return _SeqValue_W;
				}
			}

			public WhereParameter SeqDate
		    {
				get
		        {
					if(_SeqDate_W == null)
	        	    {
						_SeqDate_W = TearOff.SeqDate;
					}
					return _SeqDate_W;
				}
			}

			public WhereParameter SeqLength
		    {
				get
		        {
					if(_SeqLength_W == null)
	        	    {
						_SeqLength_W = TearOff.SeqLength;
					}
					return _SeqLength_W;
				}
			}

			private WhereParameter _SeqKey_W = null;
			private WhereParameter _SeqValue_W = null;
			private WhereParameter _SeqDate_W = null;
			private WhereParameter _SeqLength_W = null;

			public void WhereClauseReset()
			{
				_SeqKey_W = null;
				_SeqValue_W = null;
				_SeqDate_W = null;
				_SeqLength_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter SeqKey
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SeqKey, Parameters.SeqKey);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SeqValue
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SeqValue, Parameters.SeqValue);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SeqDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SeqDate, Parameters.SeqDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SeqLength
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SeqLength, Parameters.SeqLength);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter SeqKey
		    {
				get
		        {
					if(_SeqKey_W == null)
	        	    {
						_SeqKey_W = TearOff.SeqKey;
					}
					return _SeqKey_W;
				}
			}

			public AggregateParameter SeqValue
		    {
				get
		        {
					if(_SeqValue_W == null)
	        	    {
						_SeqValue_W = TearOff.SeqValue;
					}
					return _SeqValue_W;
				}
			}

			public AggregateParameter SeqDate
		    {
				get
		        {
					if(_SeqDate_W == null)
	        	    {
						_SeqDate_W = TearOff.SeqDate;
					}
					return _SeqDate_W;
				}
			}

			public AggregateParameter SeqLength
		    {
				get
		        {
					if(_SeqLength_W == null)
	        	    {
						_SeqLength_W = TearOff.SeqLength;
					}
					return _SeqLength_W;
				}
			}

			private AggregateParameter _SeqKey_W = null;
			private AggregateParameter _SeqValue_W = null;
			private AggregateParameter _SeqDate_W = null;
			private AggregateParameter _SeqLength_W = null;

			public void AggregateClauseReset()
			{
				_SeqKey_W = null;
				_SeqValue_W = null;
				_SeqDate_W = null;
				_SeqLength_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SequenceInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SequenceUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SequenceDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.SeqKey);
			p.SourceColumn = ColumnNames.SeqKey;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.SeqKey);
			p.SourceColumn = ColumnNames.SeqKey;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SeqValue);
			p.SourceColumn = ColumnNames.SeqValue;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SeqDate);
			p.SourceColumn = ColumnNames.SeqDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SeqLength);
			p.SourceColumn = ColumnNames.SeqLength;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
